
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>猜歌送红包 - 游戏题库</title>



    <link rel="shortcut icon" href="favicon.ico">
    <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/font-awesome/4.4.0/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/Admin/css/style.min.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">


    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>猜歌送红包
                        <small>添加游戏题库</small>
                    </h5>

                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal">
                        <input type="hidden" name="song_quersion_id" value="{$data['game_question']['song_quersion_id']}">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">题目</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="question" id="question" value="{$data['game_question']['question']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">答案</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="answer" id="answer" value="{$data['game_question']['answer']}">

                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">问题歌曲</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="songa" id="songa" value="{$data['game_question']['songa']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">答案歌曲</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="songb" id="songb" value="{$data['game_question']['songb']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">歌手</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="singer" id="singer" value="{$data['game_question']['singer']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">专辑</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="album" id="album" value="{$data['game_question']['album']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">曲名</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="songname" id="songname" value="{$data['game_question']['songname']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">选项1</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="puzzle1" id="puzzle1" value="{$data['game_question']['puzzle1']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">选项2</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="puzzle2" value="{$data['game_question']['puzzle2']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">选项3</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="puzzle3" value="{$data['game_question']['puzzle3']}">
                            </div>

                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">选项4</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="puzzle4" value="{$data['game_question']['puzzle4']}">
                            </div>

                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">排序</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="sort" value="{$data['game_question']['sort']}">
                            </div>

                        </div>

                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="button" onClick="save()">保存内容</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/Public/Admin/js/contabs.min.js?v=1.0"></script>
<script src="/Public/Admin/js/plugins/layer/layer.js?v=1.0"></script>
<script>

    var lock = 0;
    function save()
    {
        if(lock == 1){ return false;}

        var url = "{:U('GuessSong/game_question_add')}";
        $.ajax({
            type : 'post',
            url  : url+'?t='+Math.random(),
            data : $("form").serialize(),
            dataType : 'json',
            beforeSend: function(){
                lock = 1;
                layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
            },
            success : function(res){
                layer.closeAll();
                if(res.state > 0){
                    layer.msg('添加成功', {icon: 1});
                    var t = window.setTimeout("reload()",2000);

                }else{
                    layer.msg(res.error, {icon: 2});
                }
            },
            complete: function(){
                lock = 0;
            },
            error : function(XMLHttpRequest, textStatus, errorThrown) {
                layer.closeAll();
                layer.msg('网络失败，请刷新页面后重试', {icon: 2});
            }
        })
    }


    function reload()
    {
        //document.location.reload();//当前页面
        location.href = "{:U('GuessSong/game_question')}?";
    }

</script>

</body>

</html>
